package com.twu.biblioteca;


import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class MovieInventory {

    List<Movie> movies = new LinkedList<Movie>();

    public MovieInventory() {

        movies.add(new Movie(1, "102 Dalmatians", "2001", "Kevin Lima", "1"));
        movies.add(new Movie(2, "28 Days", "2002", "Betty Thomas", "2"));
        movies.add(new Movie(3, "3 Strikes", "2003", "DJ Pooh", "3"));
        movies.add(new Movie(4, "The 6th Day", "2004", "Roger Spottiswoode", "4"));
        movies.add(new Movie(5, "Across the Line", "2005", "Martin Spottl", "5"));
        movies.add(new Movie(6, "Adventures in Wild California", "2006", "Greg MacGillivray", "6"));
        movies.add(new Movie(7, "The Adventures of Rocky and Bullwinkle", "2007", "Des McAnuff", "7"));
        movies.add(new Movie(8, "All the Pretty Horses", "2008", "Billy Bob Thornton", "8"));
        movies.add(new Movie(9, "Almost Famous", "2009", "Cameron Crowe", "9"));
        movies.add(new Movie(10, "American Psycho", "2010", "Mary Harron", "10"));
        movies.add(new Movie(11, "Animal Factory", "2011", "Steve Buscemi", "N/A"));
        movies.add(new Movie(12, "The Art of War", "2012", "Christian Duguay", "N/A"));
        movies.add(new Movie(13, "Autumn in New York", "2013", "Joan Chen", "1"));
        movies.add(new Movie(14, "Bait", "2014", "Antoine Fuqua", "5"));
        movies.add(new Movie(15, "The great Debarers", "2008", "Winfred Ophra", "8"));
    }

    public boolean isMovieAvailable(int movieID) {

        for (Iterator i = movies.iterator(); i.hasNext(); ) {
            Movie movie = (Movie) i.next();
            if (movie.getMovieID() == movieID) {
                return true;
            }
        }
        return false;
    }

}
